<template>
    <div class="box">
        <div class="top">
            <p class="title">实时游客统计</p>
            <p class="pg"></p>
            <p class="right">可预约总量<span style="padding: 5px;">99999</span>人</p>
        </div>
        <div class="number">
            <span v-for="(item, index) in people" :key="index">{{ item }}</span>
        </div>
        <div class="charts" ref="chartsRef"></div>
    </div>
</template>

<script setup lang='ts' name='Tourist'>
import * as echarts from 'echarts'
import 'echarts-liquidfill'

let people = ref('216908人')
let chartsRef = ref()

onMounted(() => {
    // 获取echarts实例
    let myChart = echarts.init(chartsRef.value);
    myChart.setOption({
        title: {
            text: '实时游客统计'
        },
        series: [{
            type: 'liquidFill',
            data: [0.6],
            radius: '90%',
            center: ['50%', '50%'],
            backgroundStyle: {
                color: '#f5f5f5'
            },
            outline: {
                borderDistance: 0,
                itemStyle: {
                    borderWidth: 2,
                    borderColor: '#29fcff'
                }
            },
            waveAnimation: true,
            animationDuration: 1000,
            animationEasing: 'cubicOut',
            animationDurationUpdate: 1000,
            animationEasingUpdate: 'cubicOut'
        }]
    })
})
</script>

<style scoped lang='scss'>
.box {
    background: url('../../images/dataScreen-main-lb.png') no-repeat;
    background-size: 100% 100%;
    margin-top: 10px;

    .top {
        margin-left: 10px;
        color: white;
        font-size: 20px;

        .title {
            margin-top: 20px;
        }

        .pg {
            width: 68px;
            height: 7px;
            background: url('../../images/dataScreen-title.png') no-repeat;
            background-size: 100% 100%;
            margin-top: 10px;
        }

        .right {
            float: right;
            margin-top: -10px;
            margin-right: 10px;

            span {
                color: bisque;
            }
        }
    }

    .number {
        margin-top: 30px;
        display: flex;
        padding: 10px;

        span {
            flex: 1;
            height: 40px;
            text-align: center;
            line-height: 40px;
            background: url(../../images/total.png) no-repeat;
            background-size: 100% 100%;
            color: #29fcff;
            margin: 0px 2px;
            font-size: 25px;
        }
    }

    .charts {
        width: 100%;
        height: 280px;
    }
}
</style>